<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>EasyQtSql: EasyQtSql::Transaction Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">EasyQtSql
   </div>
   <div id="projectbrief">Easy SQL data access helper for QtSql</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('class_easy_qt_sql_1_1_transaction.htm','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="class_easy_qt_sql_1_1_transaction-members.htm">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">EasyQtSql::Transaction Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>QSqlDatabase transaction wrapper.  
 <a href="class_easy_qt_sql_1_1_transaction.htm#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_easy_qt_sql_8h_source.htm">EasyQtSql.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for EasyQtSql::Transaction:</div>
<div class="dyncontent">
 <div class="center">
  <img src="class_easy_qt_sql_1_1_transaction.png" usemap="#EasyQtSql::Transaction_map" alt=""/>
  <map id="EasyQtSql::Transaction_map" name="EasyQtSql::Transaction_map">
<area href="class_easy_qt_sql_1_1_database.htm" title="QSqlDatabase wrapper. " alt="EasyQtSql::Database" shape="rect" coords="0,0,142,24"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:aedec0912e122a505804913499d5a745b"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_transaction.htm#aedec0912e122a505804913499d5a745b">Transaction</a> (const QSqlDatabase &amp;db=QSqlDatabase())</td></tr>
<tr class="separator:aedec0912e122a505804913499d5a745b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa3892d2608986c42f3499ae57727db7e"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_transaction.htm#aa3892d2608986c42f3499ae57727db7e">Transaction</a> (<a class="el" href="class_easy_qt_sql_1_1_transaction.htm">Transaction</a> &amp;&amp;other)</td></tr>
<tr class="separator:aa3892d2608986c42f3499ae57727db7e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7d0b933859d1288fe3d2fb11d551b6f6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_easy_qt_sql_1_1_transaction.htm">Transaction</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_transaction.htm#a7d0b933859d1288fe3d2fb11d551b6f6">operator=</a> (<a class="el" href="class_easy_qt_sql_1_1_transaction.htm">Transaction</a> &amp;&amp;other)</td></tr>
<tr class="separator:a7d0b933859d1288fe3d2fb11d551b6f6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6b41873df9016940edb8bfadc1aeb7e5"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_transaction.htm#a6b41873df9016940edb8bfadc1aeb7e5">~Transaction</a> ()</td></tr>
<tr class="separator:a6b41873df9016940edb8bfadc1aeb7e5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1a27f0e50b10f83f9204fe8dd5076688"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_transaction.htm#a1a27f0e50b10f83f9204fe8dd5076688">commit</a> ()</td></tr>
<tr class="memdesc:a1a27f0e50b10f83f9204fe8dd5076688"><td class="mdescLeft">&#160;</td><td class="mdescRight">Commits transaction.  <a href="#a1a27f0e50b10f83f9204fe8dd5076688">More...</a><br /></td></tr>
<tr class="separator:a1a27f0e50b10f83f9204fe8dd5076688"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a361a9c648242e6ec95183569c8737679"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_transaction.htm#a361a9c648242e6ec95183569c8737679">rollback</a> ()</td></tr>
<tr class="memdesc:a361a9c648242e6ec95183569c8737679"><td class="mdescLeft">&#160;</td><td class="mdescRight">Rolls back transaction.  <a href="#a361a9c648242e6ec95183569c8737679">More...</a><br /></td></tr>
<tr class="separator:a361a9c648242e6ec95183569c8737679"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a803e510640b84e272a7d174083410c40"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_transaction.htm#a803e510640b84e272a7d174083410c40">started</a> () const</td></tr>
<tr class="memdesc:a803e510640b84e272a7d174083410c40"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns true if the transaction has been started successfully. Otherwise it returns false.  <a href="#a803e510640b84e272a7d174083410c40">More...</a><br /></td></tr>
<tr class="separator:a803e510640b84e272a7d174083410c40"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac33bfed9efbb3e7a784d6cc8090cb23a"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_transaction.htm#ac33bfed9efbb3e7a784d6cc8090cb23a">commited</a> () const</td></tr>
<tr class="memdesc:ac33bfed9efbb3e7a784d6cc8090cb23a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns true if the transaction has been commited successfully. Otherwise it returns false.  <a href="#ac33bfed9efbb3e7a784d6cc8090cb23a">More...</a><br /></td></tr>
<tr class="separator:ac33bfed9efbb3e7a784d6cc8090cb23a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_class_easy_qt_sql_1_1_database"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_class_easy_qt_sql_1_1_database')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="class_easy_qt_sql_1_1_database.htm">EasyQtSql::Database</a></td></tr>
<tr class="memitem:a456e50298d0dd2bb89ddbadee7bf2da5 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_database.htm#a456e50298d0dd2bb89ddbadee7bf2da5">Database</a> (const QSqlDatabase &amp;db=QSqlDatabase())</td></tr>
<tr class="separator:a456e50298d0dd2bb89ddbadee7bf2da5 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4ba16ffeda09410df95720f2f7e9d872 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_database.htm#a4ba16ffeda09410df95720f2f7e9d872">Database</a> (<a class="el" href="class_easy_qt_sql_1_1_database.htm">Database</a> &amp;&amp;other)</td></tr>
<tr class="separator:a4ba16ffeda09410df95720f2f7e9d872 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a00ada326c3f4b3b01be26c552ad665dc inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_easy_qt_sql_1_1_database.htm">Database</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_database.htm#a00ada326c3f4b3b01be26c552ad665dc">operator=</a> (<a class="el" href="class_easy_qt_sql_1_1_database.htm">Database</a> &amp;&amp;other)</td></tr>
<tr class="separator:a00ada326c3f4b3b01be26c552ad665dc inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a55fa6c1582cdd3dd6981f53e61dce6b4 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memItemLeft" align="right" valign="top">QSqlError&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_database.htm#a55fa6c1582cdd3dd6981f53e61dce6b4">lastError</a> () const</td></tr>
<tr class="memdesc:a55fa6c1582cdd3dd6981f53e61dce6b4 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns information about the last error that occurred on the underlying database.  <a href="class_easy_qt_sql_1_1_database.htm#a55fa6c1582cdd3dd6981f53e61dce6b4">More...</a><br /></td></tr>
<tr class="separator:a55fa6c1582cdd3dd6981f53e61dce6b4 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abd563e304bb79860237c218b8bc10acd inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_easy_qt_sql_1_1_non_query_result.htm">NonQueryResult</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_database.htm#abd563e304bb79860237c218b8bc10acd">execNonQuery</a> (const QString &amp;sql) const</td></tr>
<tr class="memdesc:abd563e304bb79860237c218b8bc10acd inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="mdescLeft">&#160;</td><td class="mdescRight">Executes non-query SQL statement (DELETE, INSERT, UPDATE, CREATE, ALTER, etc.)  <a href="class_easy_qt_sql_1_1_database.htm#abd563e304bb79860237c218b8bc10acd">More...</a><br /></td></tr>
<tr class="separator:abd563e304bb79860237c218b8bc10acd inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5ae51f8e281cc1b41d7d48b7ca659b33 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_easy_qt_sql_1_1_query_result.htm">QueryResult</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_database.htm#a5ae51f8e281cc1b41d7d48b7ca659b33">execQuery</a> (const QString &amp;sql) const</td></tr>
<tr class="memdesc:a5ae51f8e281cc1b41d7d48b7ca659b33 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="mdescLeft">&#160;</td><td class="mdescRight">Executes SELECT query.  <a href="class_easy_qt_sql_1_1_database.htm#a5ae51f8e281cc1b41d7d48b7ca659b33">More...</a><br /></td></tr>
<tr class="separator:a5ae51f8e281cc1b41d7d48b7ca659b33 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8fc62bc8b97ae861420068e2d1dcff8a inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_easy_qt_sql_1_1_insert_query.htm">InsertQuery</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_database.htm#a8fc62bc8b97ae861420068e2d1dcff8a">insertInto</a> (const QString &amp;table) const</td></tr>
<tr class="memdesc:a8fc62bc8b97ae861420068e2d1dcff8a inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates INSERT query wrapper.  <a href="class_easy_qt_sql_1_1_database.htm#a8fc62bc8b97ae861420068e2d1dcff8a">More...</a><br /></td></tr>
<tr class="separator:a8fc62bc8b97ae861420068e2d1dcff8a inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0da534e09d06f26d517c2acd41446a80 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_easy_qt_sql_1_1_delete_query.htm">DeleteQuery</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_database.htm#a0da534e09d06f26d517c2acd41446a80">deleteFrom</a> (const QString &amp;table) const</td></tr>
<tr class="memdesc:a0da534e09d06f26d517c2acd41446a80 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates DELETE query wrapper.  <a href="class_easy_qt_sql_1_1_database.htm#a0da534e09d06f26d517c2acd41446a80">More...</a><br /></td></tr>
<tr class="separator:a0da534e09d06f26d517c2acd41446a80 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad99ec8b68e916201dce33cda5018be67 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_easy_qt_sql_1_1_update_query.htm">UpdateQuery</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_database.htm#ad99ec8b68e916201dce33cda5018be67">update</a> (const QString &amp;table) const</td></tr>
<tr class="memdesc:ad99ec8b68e916201dce33cda5018be67 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates UPDATE query wrapper.  <a href="class_easy_qt_sql_1_1_database.htm#ad99ec8b68e916201dce33cda5018be67">More...</a><br /></td></tr>
<tr class="separator:ad99ec8b68e916201dce33cda5018be67 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af87d995c4cf5eaf4870befe2f973487d inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_easy_qt_sql_1_1_prepared_query.htm">PreparedQuery</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_database.htm#af87d995c4cf5eaf4870befe2f973487d">prepare</a> (const QString &amp;sql, bool forwardOnly=true) const</td></tr>
<tr class="memdesc:af87d995c4cf5eaf4870befe2f973487d inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="mdescLeft">&#160;</td><td class="mdescRight">Prepares SQL statement.  <a href="class_easy_qt_sql_1_1_database.htm#af87d995c4cf5eaf4870befe2f973487d">More...</a><br /></td></tr>
<tr class="separator:af87d995c4cf5eaf4870befe2f973487d inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad4a237ca6acca4068b005d843e1551bb inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memItemLeft" align="right" valign="top">QSqlDatabase &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_database.htm#ad4a237ca6acca4068b005d843e1551bb">qSqlDatabase</a> ()</td></tr>
<tr class="memdesc:ad4a237ca6acca4068b005d843e1551bb inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a reference to the wrapped QSqlDatabase object.  <a href="class_easy_qt_sql_1_1_database.htm#ad4a237ca6acca4068b005d843e1551bb">More...</a><br /></td></tr>
<tr class="separator:ad4a237ca6acca4068b005d843e1551bb inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa14b9309738dd427f7060a88ae193beb inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memTemplParams" colspan="2">template&lt;typename Func &gt; </td></tr>
<tr class="memitem:aa14b9309738dd427f7060a88ae193beb inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memTemplItemLeft" align="right" valign="top">int&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_database.htm#aa14b9309738dd427f7060a88ae193beb">each</a> (const QString &amp;query, Func &amp;&amp;f) const</td></tr>
<tr class="memdesc:aa14b9309738dd427f7060a88ae193beb inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="mdescLeft">&#160;</td><td class="mdescRight">Executes <em>query</em> and applies function <em>f</em> to each result row.  <a href="class_easy_qt_sql_1_1_database.htm#aa14b9309738dd427f7060a88ae193beb">More...</a><br /></td></tr>
<tr class="separator:aa14b9309738dd427f7060a88ae193beb inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7165d67d4fdfa07b3d9700d5ed5c6a63 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memTemplParams" colspan="2">template&lt;typename Func &gt; </td></tr>
<tr class="memitem:a7165d67d4fdfa07b3d9700d5ed5c6a63 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memTemplItemLeft" align="right" valign="top">int&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_database.htm#a7165d67d4fdfa07b3d9700d5ed5c6a63">first</a> (const QString &amp;query, Func &amp;&amp;f) const</td></tr>
<tr class="memdesc:a7165d67d4fdfa07b3d9700d5ed5c6a63 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="mdescLeft">&#160;</td><td class="mdescRight">Executes <em>query</em> and applies function <em>f</em> to the first result row.  <a href="class_easy_qt_sql_1_1_database.htm#a7165d67d4fdfa07b3d9700d5ed5c6a63">More...</a><br /></td></tr>
<tr class="separator:a7165d67d4fdfa07b3d9700d5ed5c6a63 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1832537434940c8334fe0ca012bee8dd inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memTemplParams" colspan="2">template&lt;typename Func &gt; </td></tr>
<tr class="memitem:a1832537434940c8334fe0ca012bee8dd inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memTemplItemLeft" align="right" valign="top">int&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_database.htm#a1832537434940c8334fe0ca012bee8dd">range</a> (const QString &amp;query, int start, int count, Func &amp;&amp;f) const</td></tr>
<tr class="memdesc:a1832537434940c8334fe0ca012bee8dd inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="mdescLeft">&#160;</td><td class="mdescRight">Executes <em>query</em> and applies function <em>f</em> to <em>count</em> result rows starting from index <em>start</em>.  <a href="class_easy_qt_sql_1_1_database.htm#a1832537434940c8334fe0ca012bee8dd">More...</a><br /></td></tr>
<tr class="separator:a1832537434940c8334fe0ca012bee8dd inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2f66f508f3cc25d0512d841f938adfb4 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memTemplParams" colspan="2">template&lt;typename Func &gt; </td></tr>
<tr class="memitem:a2f66f508f3cc25d0512d841f938adfb4 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memTemplItemLeft" align="right" valign="top">int&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_database.htm#a2f66f508f3cc25d0512d841f938adfb4">top</a> (const QString &amp;query, int topCount, Func &amp;&amp;f) const</td></tr>
<tr class="memdesc:a2f66f508f3cc25d0512d841f938adfb4 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="mdescLeft">&#160;</td><td class="mdescRight">Executes <em>query</em> and applies function <em>f</em> to <em>topCount</em> result rows.  <a href="class_easy_qt_sql_1_1_database.htm#a2f66f508f3cc25d0512d841f938adfb4">More...</a><br /></td></tr>
<tr class="separator:a2f66f508f3cc25d0512d841f938adfb4 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abada64f2593dd9524199f570d9387296 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:abada64f2593dd9524199f570d9387296 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memTemplItemLeft" align="right" valign="top">T&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_database.htm#abada64f2593dd9524199f570d9387296">scalar</a> (const QString &amp;query) const</td></tr>
<tr class="memdesc:abada64f2593dd9524199f570d9387296 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="mdescLeft">&#160;</td><td class="mdescRight">Executes <em>query</em> and returns scalar value converted to T.  <a href="class_easy_qt_sql_1_1_database.htm#abada64f2593dd9524199f570d9387296">More...</a><br /></td></tr>
<tr class="separator:abada64f2593dd9524199f570d9387296 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa06ecb239cde85058a7ed828e06906b7 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memItemLeft" align="right" valign="top">QVariant&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_database.htm#aa06ecb239cde85058a7ed828e06906b7">scalar</a> (const QString &amp;query) const</td></tr>
<tr class="memdesc:aa06ecb239cde85058a7ed828e06906b7 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="mdescLeft">&#160;</td><td class="mdescRight">Executes <em>query</em> and returns scalar value.  <a href="class_easy_qt_sql_1_1_database.htm#aa06ecb239cde85058a7ed828e06906b7">More...</a><br /></td></tr>
<tr class="separator:aa06ecb239cde85058a7ed828e06906b7 inherit pub_methods_class_easy_qt_sql_1_1_database"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="inherited"></a>
Additional Inherited Members</h2></td></tr>
<tr class="inherit_header pro_attribs_class_easy_qt_sql_1_1_database"><td colspan="2" onclick="javascript:toggleInherit('pro_attribs_class_easy_qt_sql_1_1_database')"><img src="closed.png" alt="-"/>&#160;Protected Attributes inherited from <a class="el" href="class_easy_qt_sql_1_1_database.htm">EasyQtSql::Database</a></td></tr>
<tr class="memitem:af1da52105a07c38f77aad58df9792181 inherit pro_attribs_class_easy_qt_sql_1_1_database"><td class="memItemLeft" align="right" valign="top">QSqlDatabase&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_easy_qt_sql_1_1_database.htm#af1da52105a07c38f77aad58df9792181">m_db</a></td></tr>
<tr class="separator:af1da52105a07c38f77aad58df9792181 inherit pro_attribs_class_easy_qt_sql_1_1_database"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>QSqlDatabase transaction wrapper. </p>
<p>Features:</p><ul>
<li>Automatic rollback of non-expclicitely commited transactions</li>
<li>Helper methods: <a class="el" href="class_easy_qt_sql_1_1_database.htm#abd563e304bb79860237c218b8bc10acd" title="Executes non-query SQL statement (DELETE, INSERT, UPDATE, CREATE, ALTER, etc.) ">Transaction::execNonQuery</a>, <a class="el" href="class_easy_qt_sql_1_1_database.htm#a5ae51f8e281cc1b41d7d48b7ca659b33" title="Executes SELECT query. ">Transaction::execQuery</a>, <a class="el" href="class_easy_qt_sql_1_1_database.htm#a8fc62bc8b97ae861420068e2d1dcff8a" title="Creates INSERT query wrapper. ">Transaction::insertInto</a>, <a class="el" href="class_easy_qt_sql_1_1_database.htm#a0da534e09d06f26d517c2acd41446a80" title="Creates DELETE query wrapper. ">Transaction::deleteFrom</a>, <a class="el" href="class_easy_qt_sql_1_1_database.htm#ad99ec8b68e916201dce33cda5018be67" title="Creates UPDATE query wrapper. ">Transaction::update</a>, <a class="el" href="class_easy_qt_sql_1_1_database.htm#af87d995c4cf5eaf4870befe2f973487d" title="Prepares SQL statement. ">Transaction::prepare</a>.</li>
</ul>
<div class="fragment"><div class="line"><span class="keywordtype">void</span> test()</div><div class="line">{</div><div class="line">   QSqlDatabase db = QSqlDatabase::addDatabase(<span class="stringliteral">&quot;QSQLITE&quot;</span>);</div><div class="line">   db.setDatabaseName(<span class="stringliteral">&quot;:memory:&quot;</span>);</div><div class="line">   db.open();</div><div class="line"></div><div class="line">   <span class="keywordflow">try</span></div><div class="line">   {</div><div class="line">      <a class="code" href="class_transaction.htm">Transaction</a> t(db);</div><div class="line"></div><div class="line">      t.<a class="code" href="class_database.htm#aae9f7e53275334c91655eeb7a2bde030">execNonQuery</a>(<span class="stringliteral">&quot;CREATE TABLE table (a int, b int, c int, d text)&quot;</span>);</div><div class="line"></div><div class="line">      t.<a class="code" href="class_database.htm#a8388689590c1f3adeabd2972b221bcb2">insertInto</a>(<span class="stringliteral">&quot;table (a, b, c, d)&quot;</span>)</div><div class="line">         .<a class="code" href="class_insert_query.htm#ae207fa97fdf9571fbcded31bbad9b9ed">values</a>(1, 2, 3, <span class="stringliteral">&quot;row1&quot;</span>)</div><div class="line">         .<a class="code" href="class_insert_query.htm#ae207fa97fdf9571fbcded31bbad9b9ed">values</a>(4, 5, 6, <span class="stringliteral">&quot;row2&quot;</span>)</div><div class="line">         .<a class="code" href="class_insert_query.htm#ae207fa97fdf9571fbcded31bbad9b9ed">values</a>(7, 8, 9, <span class="stringliteral">&quot;row3&quot;</span>)</div><div class="line">         .<a class="code" href="class_insert_query.htm#a385c674dfad02ee62cfc0d3e124cd33b">exec</a>();</div><div class="line"></div><div class="line">      <a class="code" href="class_prepared_query.htm">PreparedQuery</a> query = t.<a class="code" href="class_database.htm#a03e2c9113452bb52bb7018ef2366bce1">prepare</a>(<span class="stringliteral">&quot;SELECT a, b, c, d FROM table&quot;</span>);</div><div class="line"></div><div class="line">      <a class="code" href="class_query_result.htm">QueryResult</a> res = query.<a class="code" href="class_prepared_query.htm#a1013aea1638d6d04868ce39130bc1b67">exec</a>();</div><div class="line">      <span class="keywordflow">while</span> (res.<a class="code" href="class_query_result.htm#a1c756382c20c126979b28715d529c054">next</a>())</div><div class="line">      {</div><div class="line">         QVariantMap map = res.<a class="code" href="class_query_result.htm#a023bd84f7010368d616d7dbb1b399a06">toMap</a>();</div><div class="line">         qDebug() &lt;&lt; map;</div><div class="line">      }</div><div class="line"></div><div class="line">      t.<a class="code" href="class_database.htm#a2d8dad3df4134306749582216bd437e0">update</a>(<span class="stringliteral">&quot;table&quot;</span>)</div><div class="line">         .<a class="code" href="class_update_query.htm#a7c1b4eaa45048ec8a3f6f7d4223f5ace">set</a>(<span class="stringliteral">&quot;a&quot;</span>, 111)</div><div class="line">         .<a class="code" href="class_update_query.htm#a7c1b4eaa45048ec8a3f6f7d4223f5ace">set</a>(<span class="stringliteral">&quot;b&quot;</span>, 222)</div><div class="line">         .<a class="code" href="class_update_query.htm#abb4c7b7502599a78699e3a1f4cb4cbda">where</a>(<span class="stringliteral">&quot;c = ? OR c = ?&quot;</span>, 3, 6);</div><div class="line"></div><div class="line">      res = query.<a class="code" href="class_prepared_query.htm#a1013aea1638d6d04868ce39130bc1b67">exec</a>();</div><div class="line">      <span class="keywordflow">while</span> (res.<a class="code" href="class_query_result.htm#a1c756382c20c126979b28715d529c054">next</a>())</div><div class="line">      {</div><div class="line">         QVariantMap map = res.<a class="code" href="class_query_result.htm#a023bd84f7010368d616d7dbb1b399a06">toMap</a>();</div><div class="line">         qDebug() &lt;&lt; map;</div><div class="line">      }</div><div class="line"></div><div class="line">      t.<a class="code" href="class_transaction.htm#a7388031cba0416d48e03e3f7acd5ca6a">commit</a>(); <span class="comment">//the transaction will be rolled back on exit from the scope (when calling the destructor) if you do not explicitly commit</span></div><div class="line"></div><div class="line">   <span class="keywordflow">catch</span> (<span class="keyword">const</span> <a class="code" href="class_d_b_exception.htm">DBException</a> &amp;e)</div><div class="line">   {</div><div class="line">      <span class="comment">//you can handle all the errors at one point</span></div><div class="line">      <span class="comment">//the transaction will be automatically rolled back on exception</span></div><div class="line"></div><div class="line">      qDebug() &lt;&lt; e.<a class="code" href="class_d_b_exception.htm#adf142ded3fb236826a5a6ba4a606e584">lastError</a> &lt;&lt; e.<a class="code" href="class_d_b_exception.htm#a3ec8b4b593abee155554472ae0b58f12">lastQuery</a>;</div><div class="line">   }</div><div class="line">}</div></div><!-- fragment --> </div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="aedec0912e122a505804913499d5a745b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aedec0912e122a505804913499d5a745b">&#9670;&nbsp;</a></span>Transaction() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">EasyQtSql::Transaction::Transaction </td>
          <td>(</td>
          <td class="paramtype">const QSqlDatabase &amp;&#160;</td>
          <td class="paramname"><em>db</em> = <code>QSqlDatabase()</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a id="aa3892d2608986c42f3499ae57727db7e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa3892d2608986c42f3499ae57727db7e">&#9670;&nbsp;</a></span>Transaction() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">EasyQtSql::Transaction::Transaction </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_easy_qt_sql_1_1_transaction.htm">Transaction</a> &amp;&amp;&#160;</td>
          <td class="paramname"><em>other</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a id="a6b41873df9016940edb8bfadc1aeb7e5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6b41873df9016940edb8bfadc1aeb7e5">&#9670;&nbsp;</a></span>~Transaction()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">EasyQtSql::Transaction::~Transaction </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a1a27f0e50b10f83f9204fe8dd5076688"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1a27f0e50b10f83f9204fe8dd5076688">&#9670;&nbsp;</a></span>commit()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool EasyQtSql::Transaction::commit </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Commits transaction. </p>
<p>The transaction will be rolled back on calling the destructor if not explicitly commited</p>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname"><a class="el" href="class_easy_qt_sql_1_1_d_b_exception.htm" title="Exception class for SQL errors handling. ">DBException</a></td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ac33bfed9efbb3e7a784d6cc8090cb23a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac33bfed9efbb3e7a784d6cc8090cb23a">&#9670;&nbsp;</a></span>commited()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool EasyQtSql::Transaction::commited </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Returns true if the transaction has been commited successfully. Otherwise it returns false. </p>

</div>
</div>
<a id="a7d0b933859d1288fe3d2fb11d551b6f6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7d0b933859d1288fe3d2fb11d551b6f6">&#9670;&nbsp;</a></span>operator=()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_easy_qt_sql_1_1_transaction.htm">Transaction</a>&amp; EasyQtSql::Transaction::operator= </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_easy_qt_sql_1_1_transaction.htm">Transaction</a> &amp;&amp;&#160;</td>
          <td class="paramname"><em>other</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a id="a361a9c648242e6ec95183569c8737679"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a361a9c648242e6ec95183569c8737679">&#9670;&nbsp;</a></span>rollback()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool EasyQtSql::Transaction::rollback </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Rolls back transaction. </p>

</div>
</div>
<a id="a803e510640b84e272a7d174083410c40"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a803e510640b84e272a7d174083410c40">&#9670;&nbsp;</a></span>started()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool EasyQtSql::Transaction::started </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Returns true if the transaction has been started successfully. Otherwise it returns false. </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>EasyQtSql/<a class="el" href="_easy_qt_sql_8h_source.htm">EasyQtSql.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="namespace_easy_qt_sql.htm">EasyQtSql</a></li><li class="navelem"><a class="el" href="class_easy_qt_sql_1_1_transaction.htm">Transaction</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
  </ul>
</div>
</body>
</html>
